var _contextPath;
$(document).ready(function() {
	_contextPath = $("#contextPath").val();
	// merchantlist();
	});

function getContextPath() {
	if ("" == _contextPath) {
		_contextPath = $("#contextPath").val();
	}
	return _contextPath;
}

function audit() {
	var merchantId = $("#merchantId").val();
	var status = $('input:radio:checked').val();
	var checkContent = $("#checkContent").val();
	// alert(merchantId+"|"+status+"|"+checkContent);
	if (status == 0 && checkContent == '') {
		top.uppShow('请填写审核意见!');
	} else {
		$("#savab").attr('disabled', 'disabled');
		_contextPath = $("#contextPath").val();
		url = _contextPath + "iccard/merchant/audit?rid=" + Math.random();
		$('table input,textarea').attr('disabled', 'disabled');
		$.ajax( {
			type : 'POST',
			url : url,
			data : {
				'merchantId' : merchantId,
				'status' : status,
				'msg' : checkContent
			},
			dataType : 'json',
			success : function(root) {
				top.uppShow(root.msgDesc);
				// 隐藏保存按钮
			$("#savab").hide();
			// window.top.reload_merchant_list.call();
			window.location.href = getContextPath()
					+ "iccard/merchant/toListView";
			$("#savab").attr('disabled', '');
		},
		error : function(data) {
			uppAjaxError(data);
			$("#savab").attr('disabled', '');
		}
		});
	}
}

function closeBack(){
	top.closeCurrentTab(top.getCurrentTagTitle());
}

function loadExpensiveRecord(obj,merchantEncode,merchantName) {
	var backHtml = $(obj).html();
	$(obj).html('商家管理-刷卡记录');
	$(obj).attr('hiddenhref',getContextPath() + "iccard/merchant/toERListView?merchantEncode=" + merchantEncode + "&merchantName=" + merchantName);
	window.parent.menuClick(obj);
	$(obj).html(backHtml);
}

